import Base from 'models/base';

export default class ShopDetail extends Base {
  constructor(detail, type, params) {
    super();
    this.type = type;
    this.name = detail.shopName;
    this.headImg = detail.shopImg;

    if (type === 'branch') {
      this.branchId = params.branchId;
    } else {
      this.partnerId = params.partnerId;
    }

    let score = detail.score;
    this.score = score;
    score = Math.floor(score);
    this.star = score / 2;

    let packScore = detail.appraisePackScore;
    this.packScore = packScore;
    packScore = Math.floor(packScore);
    this.packStar = packScore / 2;

    let tasteScore = detail.appraiseTasteScore;
    this.tasteScore = tasteScore;
    tasteScore = Math.floor(tasteScore);
    this.tasteStar = tasteScore / 2;

    this.goodRate = detail.goodRate;
  }
}
